<?php


class UserController extends Controller {
  /**
   * 修改密码
   */
  public function actionPassword()
  {
    if(Yii::app()->request->isPostRequest && !Yii::app()->user->isGuest){
      if(UserService::instance()->changePassword(Yii::app()->user->id,CHtml::encode($_POST['password']))){
        $this->jsMsg("修改成功!");
      }else{
        $this->jsMsg("修改失败!");
      }
    }else{
      $this->error('非法访问!',400);
    }
  }
} 